/**
 * @desc 上传图片路由
 * @type {[type]}
 */
const qiniu = require('qiniu')
const accessKey = 'b29IMpn5TGcxhDKFFAtz12BBCGDHyB68zSmXeqS6';
const secretKey = 'u8Cnz73r3P-DYyFSk421Kv917Xp0bkuktFVfiOdX';
const mac = new qiniu.auth.digest.Mac(accessKey, secretKey);
const bucket = 'zuilangxing'

let  options = {
  scope: bucket,
};

let upload = (router) => {
	router.post('/uploadImg', async (ctx, next) => {
		let putPolicy = new qiniu.rs.PutPolicy(options);
		let uploadToken=putPolicy.uploadToken(mac);
		console.log('uploadImg', uploadToken);
		ctx.body = uploadToken
	})
}
module.exports = upload


